#include "testrgb.h"
#include <QPainter>
static int w = 1280,h = 720;
void TestRGB::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    QImage image(w,h,QImage::Format_RGB888);
    auto d = image.bits();
    uchar r = 255;
    for(int j =0;j<h;j++){
        r--;
        int b = j*w*3;
        for(int i = 0;i<w*3;i+=3){
            d[b+i]=r;
            d[b+i+1]=0;
            d[b+i+2]=0;
        }
    }
    painter.begin(this);
    painter.drawImage(0,0,image);
    painter.end();
}
